package com.jiangds.open.check.checker;

import com.jiangds.open.check.Checker;
import java.time.LocalDate;

/**
 * {@link LocalDateChecker}  本地日期比较
 *
 * @author jiangliang
 * @since 2021/1/6 12:46
 */
public class LocalDateChecker extends AbstractChecker<Integer, LocalDate> {

    public LocalDateChecker(LocalDate target) {
        super(target);
    }

    @Override
    public Checker<Integer, LocalDate> notEmpty() {
        return notNull();
    }

    @Override
    public Checker<Integer, LocalDate> range(Integer min, Integer max) {
       return localDateRangeProcessor(t->t,min,max);
    }

    @Override
    public Checker<Integer, LocalDate> greater(LocalDate greaterThan) {
        return processor(t->!t.isBefore(greaterThan));
    }

    @Override
    public Checker<Integer, LocalDate> less(LocalDate lessThan) {
        return processor(t->!t.isAfter(lessThan));
    }

    @Override
    public Checker<Integer, LocalDate> in(LocalDate... args) {
        return inProcessor(LocalDate::isEqual,args);
    }

}
